<?php
/**
 * quick_curd
 * ============================================================================
 * 版权所有 2024-2099 wltx666.com，并保留所有权利。
 * 网站地址: https://wltx666.com
 * ============================================================================
 * Author: 草上飞
 * Email: wltx@alipay168.cn
 * QQ: 2719875001
 * Date: 2024/12/15
 * 描述:
 */

namespace app\result;

class UploadFilesLogResult extends BaseResult
{
    //计算文件大小，返回mb、kb、gb
    static function format_size($size): string
    {
        $units = ['B', 'KB', 'MB', 'GB', 'TB'];
        for ($i = 0; $size >= 1024 && $i < 4; $i++) $size /= 1024;
        return round($size, 2) . $units[$i];
    }

    static function get_upload_type_desc($upload_type)
    {
        return match ($upload_type) {
            'local' => '本地',
            'qiniu' => '七牛云',
            'aliyun' => '阿里云',
            'tencent' => '腾讯云',
            'upyun' => '又拍云',
            'cos' => '腾讯云COS',
            'oss' => '阿里云OSS',
            'ks3' => '金山云',
            default => '未知',
        };
    }
}
